#region [file: MovimentacaoFinanceiraDAL.cs, author: CelesteMGB]
// File:    MovimentacaoFinanceiraDAL.cs
// Author:  CelesteMGB
// Created: sábado, 18 de fevereiro de 2012 13:34:29
// Purpose: Defines dao implementation class for class MovimentacaoFinanceira
#endregion

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using NHibernate.Criterion;
using DA_OOMModel;
using DA_OOMModelIDAL;

namespace DA_OOMNHibernateDAL
{
   /// <summary>
   /// Class that implements methods of IMovimentacaoFinanceiraDAL interface
   /// </summary>
   public class MovimentacaoFinanceiraDAL : NHibernateDALBase,  IMovimentacaoFinanceiraDAL 
   {
      #region CRUD methods
      /// <summary>
      /// Get all instances of MovimentacaoFinanceira
      /// </summary>     
      public List<MovimentacaoFinanceira> GetMovimentacaoFinanceiraList()
      {
         return ConvertToGenericList(base.LoadAll(typeof(MovimentacaoFinanceira)));
      }
      
      /// <summary>
      /// Get the instances of MovimentacaoFinanceira from index firstResult to index maxResult
      /// </summary>
      public List<MovimentacaoFinanceira> GetMovimentacaoFinanceiraList(int firstResult, int maxResult)
      {
         return ConvertToGenericList(base.LoadAll(typeof(MovimentacaoFinanceira), firstResult, maxResult));
      }

      /// <summary>
      /// Load the instance of MovimentacaoFinanceira according its primary key instance.
      /// </summary>
      public MovimentacaoFinanceira Load(MovimentacaoFinanceiraPK movimentacaoFinanceiraPK)
      {
         IList cs = new ArrayList();
         string[] paramNames = new string[] { "MovIdMovimentacao" };
         object[] values = new object[] { movimentacaoFinanceiraPK.MovIdMovimentacao };
         for (int i = 0; i < paramNames.Length; i++)
             cs.Add(Expression.Eq(paramNames[i], values[i]));

         IList list = base.FindByCriterions(typeof(MovimentacaoFinanceira), cs);
         return (((list != null) && (list.Count > 0)) ? (MovimentacaoFinanceira)list[0] : null);
      }

      /// <summary>
      /// Query the instances of MovimentacaoFinanceira according its example instance.
      /// </summary>
      public List<MovimentacaoFinanceira> QueryByExample(MovimentacaoFinanceira movimentacaoFinanceira)
      {
         return ConvertToGenericList(base.QueryByExample(typeof(MovimentacaoFinanceira), movimentacaoFinanceira));
      }

      /// <summary>
      /// Query the instances of MovimentacaoFinanceira according its example instance from index firstResult to index maxResult
      /// </summary>
      public List<MovimentacaoFinanceira> QueryByExample(MovimentacaoFinanceira movimentacaoFinanceira, int firstResult, int maxResult)
      {
         return ConvertToGenericList(base.QueryByExample(typeof(MovimentacaoFinanceira), movimentacaoFinanceira, firstResult, maxResult));
      }
      
      /// <summary>
      /// Insert the instances of MovimentacaoFinanceira
      /// </summary>
      public void Insert(MovimentacaoFinanceira movimentacaoFinanceiraObject)
      {
         base.Save(movimentacaoFinanceiraObject);
      }
      
      /// <summary>
      /// Update the instances of MovimentacaoFinanceira
      /// </summary>
      public void Update(MovimentacaoFinanceira movimentacaoFinanceiraObject)
      {
         base.Update(movimentacaoFinanceiraObject);
      }
      
      /// <summary>
      /// Delete the instances of MovimentacaoFinanceira
      /// </summary>
      public void Delete(MovimentacaoFinanceira movimentacaoFinanceiraObject)
      {
         base.Delete(movimentacaoFinanceiraObject);
      }
      #endregion
      
   
      /// <summary>
      /// Find the instances of MovimentacaoFinanceira according to its attribute movTpMovimentacao
      /// </summary>
      public List<MovimentacaoFinanceira> FindByMovTpMovimentacao(string movTpMovimentacao) 
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("MovTpMovimentacao", movTpMovimentacao));
         return ConvertToGenericList(base.FindByCriterions(typeof(MovimentacaoFinanceira), cs));
      }
      
      /// <summary>
      /// Find the instances of MovimentacaoFinanceira according to its attribute movTpMovimentacao, 
      /// and the result is from index firstResult to  index maxResult
      /// </summary>
      public List<MovimentacaoFinanceira> FindByMovTpMovimentacao(string movTpMovimentacao, int firstResult, int maxResult)
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("MovTpMovimentacao", movTpMovimentacao));
         return ConvertToGenericList(base.FindByCriterions(typeof(MovimentacaoFinanceira), cs, firstResult, maxResult));
      }
      
      
      /// <summary>
      /// Find the instances of MovimentacaoFinanceira according to its attribute movDtMovimentacao
      /// </summary>
      public List<MovimentacaoFinanceira> FindByMovDtMovimentacao(DateTime movDtMovimentacao) 
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("MovDtMovimentacao", movDtMovimentacao));
         return ConvertToGenericList(base.FindByCriterions(typeof(MovimentacaoFinanceira), cs));
      }
      
      /// <summary>
      /// Find the instances of MovimentacaoFinanceira according to its attribute movDtMovimentacao, 
      /// and the result is from index firstResult to  index maxResult
      /// </summary>
      public List<MovimentacaoFinanceira> FindByMovDtMovimentacao(DateTime movDtMovimentacao, int firstResult, int maxResult)
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("MovDtMovimentacao", movDtMovimentacao));
         return ConvertToGenericList(base.FindByCriterions(typeof(MovimentacaoFinanceira), cs, firstResult, maxResult));
      }

      /// <summary>
      /// Convert the IList to the generic List instance.
      /// </summary>
      private List<MovimentacaoFinanceira> ConvertToGenericList(IList movimentacaoFinanceiras)
      {
         List<MovimentacaoFinanceira> movimentacaoFinanceiraList = new List<MovimentacaoFinanceira>();
         foreach (MovimentacaoFinanceira movimentacaoFinanceira in movimentacaoFinanceiras)
         {
             movimentacaoFinanceiraList.Add(movimentacaoFinanceira);
         }
         return movimentacaoFinanceiraList;
      }      
   }
}